<?php

namespace Cps\Model;

use Think\Model;

/**
 * Description of AdminModel
 *
 * @author xtceetg
 */
class CpsModel extends Model {

    protected $tableName="game_server_list";
    
    public function getGameList($count=0,$firstRow,$listRows){
        if($count==0){
            $sql="SELECT a.area_num,a.game_id,g.gamename,a.areaname FROM game_server_list AS a ,game_list AS g WHERE a.game_id = g.id ORDER BY a.open_time DESC";
            return count($this->query($sql));
        }else{
            $sql="SELECT a.area_num,a.game_id,g.gamename,a.areaname FROM game_server_list AS a ,game_list AS g WHERE a.game_id = g.id ORDER BY a.open_time DESC limit {$firstRow},{$listRows}";
            return $this->query($sql);
        }
    }

}
